1
0

hdfs_shim.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. #include "libhdfs_wrapper.h"
  19. #include "libhdfspp_wrapper.h"
  20. #include "hdfs/hdfs.h"
  21. #include <stdio.h>
  22. #include <stdlib.h>
  23. #include <string.h>
  24. /* Shim structs and functions that delegate to libhdfspp and libhdfs. */
  25. struct hdfs_internal {
  26. libhdfs_hdfsFS libhdfsRep;
  27. libhdfspp_hdfsFS libhdfsppRep;
  28. };
  29. typedef struct hdfs_internal* hdfsFS;
  30. struct hdfsFile_internal {
  31. libhdfs_hdfsFile libhdfsRep;
  32. libhdfspp_hdfsFile libhdfsppRep;
  33. };
  34. typedef struct hdfsFile_internal* hdfsFile;
  35. struct hdfsBuilder {
  36. struct hdfsBuilder * libhdfs_builder;
  37. struct hdfsBuilder * libhdfspp_builder;
  38. };
  39. #define REPORT_FUNCTION_NOT_IMPLEMENTED \
  40. fprintf(stderr, "%s failed: function not implemented by " \
  41. "libhdfs++ test shim", __PRETTY_FUNCTION__);
  42. int hdfsFileIsOpenForWrite(hdfsFile file) {
  43. return libhdfs_hdfsFileIsOpenForWrite(file->libhdfsRep);
  44. }
  45. int hdfsFileGetReadStatistics(hdfsFile file, struct hdfsReadStatistics **stats) {
  46. //We do not track which bytes were remote or local, so we assume all are local
  47. int ret = libhdfspp_hdfsFileGetReadStatistics(file->libhdfsppRep, (struct libhdfspp_hdfsReadStatistics **)stats);
  48. if(!ret) {
  49. (*stats)->totalLocalBytesRead = (*stats)->totalBytesRead;
  50. }
  51. return ret;
  52. }
  53. int64_t hdfsReadStatisticsGetRemoteBytesRead(const struct hdfsReadStatistics *stats) {
  54. return libhdfspp_hdfsReadStatisticsGetRemoteBytesRead((struct libhdfspp_hdfsReadStatistics *)stats);
  55. }
  56. int hdfsFileClearReadStatistics(hdfsFile file) {
  57. return libhdfspp_hdfsFileClearReadStatistics(file->libhdfsppRep);
  58. }
  59. void hdfsFileFreeReadStatistics(struct hdfsReadStatistics *stats) {
  60. libhdfspp_hdfsFileFreeReadStatistics((struct libhdfspp_hdfsReadStatistics *)stats);
  61. }
  62. hdfsFS hdfsConnectAsUser(const char* nn, tPort port, const char *user) {
  63. hdfsFS ret = calloc(1, sizeof(struct hdfs_internal));
  64. ret->libhdfsRep = libhdfs_hdfsConnectAsUser(nn, port, user);
  65. if (!ret->libhdfsRep) {
  66. libhdfs_hdfsDisconnect(ret->libhdfsRep);
  67. free(ret);
  68. return NULL;
  69. }
  70. ret->libhdfsppRep = libhdfspp_hdfsConnectAsUser(nn, port, user);
  71. if (!ret->libhdfsppRep) {
  72. libhdfs_hdfsDisconnect(ret->libhdfsRep);
  73. free(ret);
  74. return NULL;
  75. }
  76. return ret;
  77. }
  78. hdfsFS hdfsConnect(const char* nn, tPort port) {
  79. hdfsFS ret = calloc(1, sizeof(struct hdfs_internal));
  80. ret->libhdfsRep = libhdfs_hdfsConnect(nn, port);
  81. if (!ret->libhdfsRep) {
  82. libhdfs_hdfsDisconnect(ret->libhdfsRep);
  83. free(ret);
  84. return NULL;
  85. }
  86. ret->libhdfsppRep = libhdfspp_hdfsConnect(nn, port);
  87. if (!ret->libhdfsppRep) {
  88. libhdfs_hdfsDisconnect(ret->libhdfsRep);
  89. free(ret);
  90. return NULL;
  91. }
  92. return ret;
  93. }
  94. hdfsFS hdfsConnectAsUserNewInstance(const char* nn, tPort port, const char *user ) {
  95. hdfsFS ret = calloc(1, sizeof(struct hdfs_internal));
  96. ret->libhdfsRep = libhdfs_hdfsConnectAsUserNewInstance(nn, port, user);
  97. if (!ret->libhdfsRep) {
  98. libhdfs_hdfsDisconnect(ret->libhdfsRep);
  99. free(ret);
  100. return NULL;
  101. }
  102. ret->libhdfsppRep = libhdfspp_hdfsConnectAsUserNewInstance(nn, port, user);
  103. if (!ret->libhdfsppRep) {
  104. libhdfs_hdfsDisconnect(ret->libhdfsRep);
  105. free(ret);
  106. return NULL;
  107. }
  108. return ret;
  109. }
  110. hdfsFS hdfsConnectNewInstance(const char* nn, tPort port) {
  111. hdfsFS ret = calloc(1, sizeof(struct hdfs_internal));
  112. ret->libhdfsRep = libhdfs_hdfsConnectNewInstance(nn, port);
  113. if (!ret->libhdfsRep) {
  114. libhdfs_hdfsDisconnect(ret->libhdfsRep);
  115. free(ret);
  116. return NULL;
  117. }
  118. ret->libhdfsppRep = libhdfspp_hdfsConnectNewInstance(nn, port);
  119. if (!ret->libhdfsppRep) {
  120. libhdfs_hdfsDisconnect(ret->libhdfsRep);
  121. free(ret);
  122. return NULL;
  123. }
  124. return ret;
  125. }
  126. hdfsFS hdfsBuilderConnect(struct hdfsBuilder *bld) {
  127. hdfsFS ret = calloc(1, sizeof(struct hdfs_internal));
  128. ret->libhdfsRep = libhdfs_hdfsBuilderConnect(bld->libhdfs_builder);
  129. if (!ret->libhdfsRep) {
  130. free(ret);
  131. return NULL;
  132. }
  133. /* Destroys bld object. */
  134. ret->libhdfsppRep = libhdfspp_hdfsBuilderConnect(bld->libhdfspp_builder);
  135. if (!ret->libhdfsppRep) {
  136. libhdfs_hdfsDisconnect(ret->libhdfsRep);
  137. free(ret);
  138. return NULL;
  139. }
  140. return ret;
  141. }
  142. struct hdfsBuilder *hdfsNewBuilder(void) {
  143. struct hdfsBuilder * result = calloc(1, sizeof(struct hdfsBuilder));
  144. result -> libhdfs_builder = libhdfs_hdfsNewBuilder();
  145. result -> libhdfspp_builder = libhdfspp_hdfsNewBuilder();
  146. return result;
  147. }
  148. void hdfsBuilderSetForceNewInstance(struct hdfsBuilder *bld) {
  149. libhdfs_hdfsBuilderSetForceNewInstance(bld->libhdfs_builder);
  150. libhdfspp_hdfsBuilderSetForceNewInstance(bld->libhdfspp_builder);
  151. }
  152. void hdfsBuilderSetNameNode(struct hdfsBuilder *bld, const char *nn) {
  153. libhdfs_hdfsBuilderSetNameNode(bld->libhdfs_builder, nn);
  154. libhdfspp_hdfsBuilderSetNameNode(bld->libhdfspp_builder, nn);
  155. }
  156. void hdfsBuilderSetNameNodePort(struct hdfsBuilder *bld, tPort port) {
  157. libhdfs_hdfsBuilderSetNameNodePort(bld->libhdfs_builder, port);
  158. libhdfspp_hdfsBuilderSetNameNodePort(bld->libhdfspp_builder, port);
  159. }
  160. void hdfsBuilderSetUserName(struct hdfsBuilder *bld, const char *userName) {
  161. libhdfs_hdfsBuilderSetUserName(bld->libhdfs_builder, userName);
  162. libhdfspp_hdfsBuilderSetUserName(bld->libhdfspp_builder, userName);
  163. }
  164. void hdfsBuilderSetKerbTicketCachePath(struct hdfsBuilder *bld,
  165. const char *kerbTicketCachePath) {
  166. REPORT_FUNCTION_NOT_IMPLEMENTED
  167. }
  168. void hdfsFreeBuilder(struct hdfsBuilder *bld) {
  169. libhdfs_hdfsFreeBuilder(bld->libhdfs_builder);
  170. libhdfspp_hdfsFreeBuilder(bld->libhdfspp_builder);
  171. free(bld);
  172. }
  173. int hdfsBuilderConfSetStr(struct hdfsBuilder *bld, const char *key,
  174. const char *val) {
  175. int ret = libhdfs_hdfsBuilderConfSetStr(bld->libhdfs_builder, key, val);
  176. if (ret) {
  177. return ret;
  178. }
  179. ret = libhdfspp_hdfsBuilderConfSetStr(bld->libhdfspp_builder, key, val);
  180. if (ret) {
  181. return ret;
  182. }
  183. return 0;
  184. }
  185. int hdfsConfGetStr(const char *key, char **val) {
  186. return libhdfspp_hdfsConfGetStr(key, val);
  187. }
  188. int hdfsConfGetInt(const char *key, int32_t *val) {
  189. return libhdfspp_hdfsConfGetInt(key, val);
  190. }
  191. void hdfsConfStrFree(char *val) {
  192. libhdfspp_hdfsConfStrFree(val);
  193. }
  194. int hdfsDisconnect(hdfsFS fs) {
  195. int ret1 = libhdfs_hdfsDisconnect(fs->libhdfsRep);
  196. int ret2 = libhdfspp_hdfsDisconnect(fs->libhdfsppRep);
  197. free(fs);
  198. if (ret1){
  199. return ret1;
  200. } else if (ret2){
  201. return ret2;
  202. } else {
  203. return 0;
  204. }
  205. }
  206. hdfsFile hdfsOpenFile(hdfsFS fs, const char* path, int flags,
  207. int bufferSize, short replication, tSize blocksize) {
  208. hdfsFile ret = calloc(1, sizeof(struct hdfsFile_internal));
  209. /* Currently only open libhdf++ for reads. */
  210. ret->libhdfsppRep = 0;
  211. if (flags == O_RDONLY) {
  212. ret->libhdfsppRep = libhdfspp_hdfsOpenFile(fs->libhdfsppRep, path, flags,
  213. bufferSize, replication, blocksize);
  214. }
  215. ret->libhdfsRep = libhdfs_hdfsOpenFile(fs->libhdfsRep, path,
  216. flags, bufferSize, replication, blocksize);
  217. if (!ret->libhdfsRep) {
  218. free(ret);
  219. ret = NULL;
  220. }
  221. return ret;
  222. }
  223. int hdfsTruncateFile(hdfsFS fs, const char* path, tOffset newlength) {
  224. return libhdfs_hdfsTruncateFile(fs->libhdfsRep, path, newlength);
  225. }
  226. int hdfsUnbufferFile(hdfsFile file) {
  227. return libhdfs_hdfsUnbufferFile(file->libhdfsRep);
  228. }
  229. int hdfsCloseFile(hdfsFS fs, hdfsFile file) {
  230. int ret;
  231. if (file->libhdfsppRep) {
  232. libhdfspp_hdfsCloseFile(fs->libhdfsppRep, file->libhdfsppRep);
  233. }
  234. ret = libhdfs_hdfsCloseFile(fs->libhdfsRep, file->libhdfsRep);
  235. free(file);
  236. return ret;
  237. }
  238. int hdfsExists(hdfsFS fs, const char *path) {
  239. return libhdfspp_hdfsExists(fs->libhdfsppRep, path);
  240. }
  241. int hdfsSeek(hdfsFS fs, hdfsFile file, tOffset desiredPos) {
  242. int ret1 = libhdfs_hdfsSeek(fs->libhdfsRep, file->libhdfsRep, desiredPos);
  243. int ret2 = libhdfspp_hdfsSeek(fs->libhdfsppRep, file->libhdfsppRep, desiredPos);
  244. if (ret1) {
  245. return ret1;
  246. } else if (ret2) {
  247. return ret2;
  248. } else {
  249. return 0;
  250. }
  251. }
  252. tOffset hdfsTell(hdfsFS fs, hdfsFile file) {
  253. tOffset ret1 = libhdfs_hdfsTell(fs->libhdfsRep, file->libhdfsRep);
  254. tOffset ret2 = libhdfspp_hdfsTell(fs->libhdfsppRep, file->libhdfsppRep);
  255. if (ret1 != ret2) {
  256. errno = EIO;
  257. return -1;
  258. } else {
  259. return ret1;
  260. }
  261. }
  262. tSize hdfsRead(hdfsFS fs, hdfsFile file, void* buffer, tSize length) {
  263. // Read to update stats.
  264. tSize nRead = libhdfs_hdfsRead(fs->libhdfsRep, file->libhdfsRep, buffer, length);
  265. // Clear to avoid false positives.
  266. if (nRead > 0) memset(buffer, 0, nRead);
  267. return libhdfspp_hdfsRead(fs->libhdfsppRep, file->libhdfsppRep, buffer, length);
  268. }
  269. tSize hdfsPread(hdfsFS fs, hdfsFile file, tOffset position,
  270. void* buffer, tSize length) {
  271. tSize ret = -1;
  272. if (!fs->libhdfsppRep) {
  273. fprintf(stderr, "hdfsPread failed: no libhdfs++ file system");
  274. } else if (!file->libhdfsppRep) {
  275. fprintf(stderr, "hdfsPread failed: no libhdfs++ file");
  276. } else {
  277. ret = libhdfspp_hdfsPread(fs->libhdfsppRep, file->libhdfsppRep,
  278. position, buffer, length);
  279. }
  280. return ret;
  281. }
  282. int hdfsPreadFully(hdfsFS fs, hdfsFile file, tOffset position,
  283. void* buffer, tSize length) {
  284. return libhdfs_hdfsPreadFully(fs->libhdfsRep, file->libhdfsRep, position,
  285. buffer, length);
  286. }
  287. tSize hdfsWrite(hdfsFS fs, hdfsFile file, const void* buffer,
  288. tSize length) {
  289. return libhdfs_hdfsWrite(fs->libhdfsRep, file->libhdfsRep, buffer, length);
  290. }
  291. int hdfsFlush(hdfsFS fs, hdfsFile file) {
  292. return libhdfs_hdfsFlush(fs->libhdfsRep, file->libhdfsRep);
  293. }
  294. int hdfsHFlush(hdfsFS fs, hdfsFile file) {
  295. return libhdfs_hdfsHFlush(fs->libhdfsRep, file->libhdfsRep);
  296. }
  297. int hdfsHSync(hdfsFS fs, hdfsFile file) {
  298. return libhdfs_hdfsHSync(fs->libhdfsRep, file->libhdfsRep);
  299. }
  300. int hdfsAvailable(hdfsFS fs, hdfsFile file) {
  301. return libhdfspp_hdfsAvailable(fs->libhdfsppRep, file->libhdfsppRep);
  302. }
  303. int hdfsCopy(hdfsFS srcFS, const char* src, hdfsFS dstFS, const char* dst) {
  304. return libhdfs_hdfsCopy(srcFS->libhdfsRep, src, dstFS->libhdfsRep, dst);
  305. }
  306. int hdfsMove(hdfsFS srcFS, const char* src, hdfsFS dstFS, const char* dst) {
  307. return libhdfs_hdfsMove(srcFS->libhdfsRep, src, dstFS->libhdfsRep, dst);
  308. }
  309. int hdfsDelete(hdfsFS fs, const char* path, int recursive) {
  310. return libhdfspp_hdfsDelete(fs->libhdfsppRep, path, recursive);
  311. }
  312. int hdfsRename(hdfsFS fs, const char* oldPath, const char* newPath) {
  313. return libhdfspp_hdfsRename(fs->libhdfsppRep, oldPath, newPath);
  314. }
  315. char* hdfsGetWorkingDirectory(hdfsFS fs, char *buffer, size_t bufferSize) {
  316. return libhdfspp_hdfsGetWorkingDirectory(fs->libhdfsppRep, buffer, bufferSize);
  317. }
  318. int hdfsSetWorkingDirectory(hdfsFS fs, const char* path) {
  319. int ret1 = libhdfspp_hdfsSetWorkingDirectory(fs->libhdfsppRep, path);
  320. int ret2 = libhdfs_hdfsSetWorkingDirectory(fs->libhdfsRep, path);
  321. if (ret1) {
  322. return ret1;
  323. } else if (ret2) {
  324. return ret2;
  325. } else {
  326. return 0;
  327. }
  328. }
  329. int hdfsCreateDirectory(hdfsFS fs, const char* path) {
  330. return libhdfspp_hdfsCreateDirectory(fs->libhdfsppRep, path);
  331. }
  332. int hdfsSetReplication(hdfsFS fs, const char* path, int16_t replication) {
  333. return libhdfspp_hdfsSetReplication(fs->libhdfsppRep, path, replication);
  334. }
  335. hdfsFileInfo *hdfsListDirectory(hdfsFS fs, const char* path,
  336. int *numEntries) {
  337. return (hdfsFileInfo *)libhdfspp_hdfsListDirectory(fs->libhdfsppRep, path, numEntries);
  338. }
  339. hdfsFileInfo *hdfsGetPathInfo(hdfsFS fs, const char* path) {
  340. return (hdfsFileInfo *)libhdfspp_hdfsGetPathInfo(fs->libhdfsppRep, path);
  341. }
  342. void hdfsFreeFileInfo(hdfsFileInfo *hdfsFileInfo, int numEntries) {
  343. return libhdfspp_hdfsFreeFileInfo
  344. ((libhdfspp_hdfsFileInfo *) hdfsFileInfo, numEntries);
  345. }
  346. int hdfsFileIsEncrypted(hdfsFileInfo *hdfsFileInfo) {
  347. return libhdfs_hdfsFileIsEncrypted
  348. ((libhdfs_hdfsFileInfo *) hdfsFileInfo);
  349. }
  350. char*** hdfsGetHosts(hdfsFS fs, const char* path,
  351. tOffset start, tOffset length) {
  352. return libhdfspp_hdfsGetHosts(fs->libhdfsppRep, path, start, length);
  353. }
  354. void hdfsFreeHosts(char ***blockHosts) {
  355. return libhdfspp_hdfsFreeHosts(blockHosts);
  356. }
  357. tOffset hdfsGetDefaultBlockSize(hdfsFS fs) {
  358. return libhdfspp_hdfsGetDefaultBlockSize(fs->libhdfsppRep);
  359. }
  360. tOffset hdfsGetDefaultBlockSizeAtPath(hdfsFS fs, const char *path) {
  361. return libhdfspp_hdfsGetDefaultBlockSizeAtPath(fs->libhdfsppRep, path);
  362. }
  363. tOffset hdfsGetCapacity(hdfsFS fs) {
  364. return libhdfspp_hdfsGetCapacity(fs->libhdfsppRep);
  365. }
  366. tOffset hdfsGetUsed(hdfsFS fs) {
  367. return libhdfspp_hdfsGetUsed(fs->libhdfsppRep);
  368. }
  369. int hdfsChown(hdfsFS fs, const char* path, const char *owner,
  370. const char *group) {
  371. return libhdfspp_hdfsChown(fs->libhdfsppRep, path, owner, group);
  372. }
  373. int hdfsChmod(hdfsFS fs, const char* path, short mode) {
  374. return libhdfspp_hdfsChmod(fs->libhdfsppRep, path, mode);
  375. }
  376. int hdfsUtime(hdfsFS fs, const char* path, tTime mtime, tTime atime) {
  377. return libhdfspp_hdfsUtime(fs->libhdfsppRep, path, mtime, atime);
  378. }
  379. struct hadoopRzOptions *hadoopRzOptionsAlloc(void) {
  380. return libhdfs_hadoopRzOptionsAlloc();
  381. }
  382. int hadoopRzOptionsSetSkipChecksum(
  383. struct hadoopRzOptions *opts, int skip) {
  384. return libhdfs_hadoopRzOptionsSetSkipChecksum(opts, skip);
  385. }
  386. int hadoopRzOptionsSetByteBufferPool(
  387. struct hadoopRzOptions *opts, const char *className) {
  388. return libhdfs_hadoopRzOptionsSetByteBufferPool(opts, className);
  389. }
  390. void hadoopRzOptionsFree(struct hadoopRzOptions *opts) {
  391. libhdfs_hadoopRzOptionsFree(opts);
  392. }
  393. struct hadoopRzBuffer* hadoopReadZero(hdfsFile file,
  394. struct hadoopRzOptions *opts, int32_t maxLength) {
  395. return libhdfs_hadoopReadZero(file->libhdfsRep, opts, maxLength);
  396. }
  397. int32_t hadoopRzBufferLength(const struct hadoopRzBuffer *buffer) {
  398. return libhdfs_hadoopRzBufferLength(buffer);
  399. }
  400. const void *hadoopRzBufferGet(const struct hadoopRzBuffer *buffer) {
  401. return libhdfs_hadoopRzBufferGet(buffer);
  402. }
  403. void hadoopRzBufferFree(hdfsFile file, struct hadoopRzBuffer *buffer) {
  404. return libhdfs_hadoopRzBufferFree(file->libhdfsRep, buffer);
  405. }
  406. int hdfsGetHedgedReadMetrics(hdfsFS fs, struct hdfsHedgedReadMetrics **metrics) {
  407. return libhdfs_hdfsGetHedgedReadMetrics(fs->libhdfsRep, (struct libhdfs_hdfsHedgedReadMetrics **) metrics);
  408. }
  409. void hdfsFreeHedgedReadMetrics(struct hdfsHedgedReadMetrics *metrics) {
  410. return libhdfs_hdfsFreeHedgedReadMetrics((struct libhdfs_hdfsHedgedReadMetrics *) metrics);
  411. }
  412. /*************
  413. * hdfs_ext functions
  414. */
  415. int hdfsGetLastError(char *buf, int len) {
  416. return libhdfspp_hdfsGetLastError(buf, len);
  417. }
  418. int hdfsCancel(hdfsFS fs, hdfsFile file) {
  419. return libhdfspp_hdfsCancel(fs->libhdfsppRep, file->libhdfsppRep);
  420. }
  421. int hdfsGetBlockLocations(hdfsFS fs, const char *path, struct hdfsBlockLocations ** locations) {
  422. return libhdfspp_hdfsGetBlockLocations(fs->libhdfsppRep, path, locations);
  423. }
  424. int hdfsFreeBlockLocations(struct hdfsBlockLocations * locations) {
  425. return libhdfspp_hdfsFreeBlockLocations(locations);
  426. }
  427. hdfsFileInfo *hdfsFind(hdfsFS fs, const char* path, const char* name, uint32_t *numEntries) {
  428. return (hdfsFileInfo *)libhdfspp_hdfsFind(fs->libhdfsppRep, path, name, numEntries);
  429. }
  430. int hdfsCreateSnapshot(hdfsFS fs, const char* path, const char* name) {
  431. return libhdfspp_hdfsCreateSnapshot(fs->libhdfsppRep, path, name);
  432. }
  433. int hdfsDeleteSnapshot(hdfsFS fs, const char* path, const char* name) {
  434. return libhdfspp_hdfsDeleteSnapshot(fs->libhdfsppRep, path, name);
  435. }
  436. int hdfsRenameSnapshot(hdfsFS fs, const char* path, const char* old_name, const char* new_name) {
  437. return libhdfspp_hdfsRenameSnapshot(fs->libhdfsppRep, path, old_name, new_name);
  438. }
  439. int hdfsAllowSnapshot(hdfsFS fs, const char* path) {
  440. return libhdfspp_hdfsAllowSnapshot(fs->libhdfsppRep, path);
  441. }
  442. int hdfsDisallowSnapshot(hdfsFS fs, const char* path) {
  443. return libhdfspp_hdfsDisallowSnapshot(fs->libhdfsppRep, path);
  444. }