userfs.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  1. /****************************************************************************
  2. * include/nuttx/fs/userfs.h
  3. *
  4. * Copyright (C) 2017-2018 Gregory Nutt. All rights reserved.
  5. * Author: Gregory Nutt <gnutt@nuttx.org>
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. *
  11. * 1. Redistributions of source code must retain the above copyright
  12. * notice, this list of conditions and the following disclaimer.
  13. * 2. Redistributions in binary form must reproduce the above copyright
  14. * notice, this list of conditions and the following disclaimer in
  15. * the documentation and/or other materials provided with the
  16. * distribution.
  17. * 3. Neither the name NuttX nor the names of its contributors may be
  18. * used to endorse or promote products derived from this software
  19. * without specific prior written permission.
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  24. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  25. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  26. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  27. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  28. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  29. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  31. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  32. * POSSIBILITY OF SUCH DAMAGE.
  33. *
  34. ****************************************************************************/
  35. #ifndef __INCLUDE_NUTTX_FS_USERFSFS_H
  36. #define __INCLUDE_NUTTX_FS_USERFSFS_H
  37. /* UserFS is implemented by two components:
  38. *
  39. * 1. A component as part of the internal OS file system logic. This
  40. * file system receives the file system requests and marshals the request
  41. * as described by the following structures, and sends this marshaled
  42. * request on a FIFO that was created by userfs_run(). It also receives
  43. * the marshal led response by the application file system, unmarshals the
  44. * response, and provides the file system response to the caller.
  45. * 2. userfs_run() is part of the NuttX C library. It receives the marshaled
  46. * operating system requests on the FIFO, unmarshals it, and calls the
  47. * application file system methods on behalf of the OS. It the marshals
  48. * the application response data and sends this back to the waiting
  49. * OS file system logic.
  50. *
  51. * Overview of general operation flow:
  52. *
  53. * 1. The UserFS OS support will be instantiated when the UserFS is mounted
  54. * based upon the configuration passed in the optional data of the
  55. * mount command.
  56. * 2. The UserFS server port number will be configured to communicate on a
  57. * LocalHost UDP socket with the server portof 0x83nn where nn is the
  58. * value that was provided when file system was created.
  59. * 3. The UserFs will receive system file system requests and forward them
  60. * on the the MqUfsReqN to the user-space file system server
  61. * (userfs_run()). These requests may be accompanied by additional data in
  62. * an provided request buffer that was provided when the UserFS was
  63. * created. This buffer would hold, for example, the data to be
  64. * written that would accompany a write request.
  65. * 4. The user-space logic of userfs_run() listens at the other end of the
  66. * LocalHost socket. It will receive the requests and forward them
  67. * to the user file system implementation via the methods of struct
  68. * userfs_operations_s
  69. * 5. Responses generated by the struct userfs_operations_s method will be
  70. * returned to UserFS via the LocalHost socket.
  71. * 6. The UserFS kernel thread will listen on the LocalHost socket
  72. * and will receive the user file system responses and forward them to
  73. * the kernel-space file system client.
  74. */
  75. /****************************************************************************
  76. * Included Files
  77. ****************************************************************************/
  78. #include <nuttx/config.h>
  79. #include <sys/types.h>
  80. #include <sys/socket.h>
  81. #include <sys/statfs.h>
  82. #include <sys/stat.h>
  83. #include <dirent.h>
  84. #include <nuttx/fs/fs.h>
  85. #ifdef CONFIG_FS_USERFS
  86. /****************************************************************************
  87. * Pre-processor Definitions
  88. ****************************************************************************/
  89. /* UserFS IOCTLs are defined in included/nuttx/fs/ioctl.h. There is only one:
  90. *
  91. * FIONUSERFS. The is the IOCTL that is used with the dev/userfs factory to
  92. * create a UserFS instance.
  93. *
  94. * Input: This function receives an pointer to a read-only instance of
  95. * struct userfs_config_s that contains information needed to
  96. * configure the UserFS instance.
  97. * Output: On success the UserFS nn instance is created. nn is non-negative
  98. * and will be provided as the IOCTL return value on success. On
  99. * failure, ioctl() will return -1 with the errno variable set to
  100. * indicate the cause of the failure.
  101. */
  102. /* This is the base value of the server port number. The actual range is
  103. * 0x8300 through 0x83ff.
  104. */
  105. #define USERFS_SERVER_PORTBASE 0x8300
  106. /* It looks like the maximum size of a request is 16 bytes. We will allow a
  107. * little more for the maximum size of a request structure.
  108. */
  109. #define USERFS_REQ_MAXSIZE (32)
  110. /****************************************************************************
  111. * Public Data
  112. ****************************************************************************/
  113. /* This enumeration provides the type of each request sent from the OS file
  114. * system client to the user file system.
  115. */
  116. enum userfs_req_e
  117. {
  118. USERFS_REQ_OPEN = 0,
  119. USERFS_REQ_CLOSE,
  120. USERFS_REQ_READ,
  121. USERFS_REQ_WRITE,
  122. USERFS_REQ_SEEK,
  123. USERFS_REQ_IOCTL,
  124. USERFS_REQ_SYNC,
  125. USERFS_REQ_DUP,
  126. USERFS_REQ_FSTAT,
  127. USERFS_REQ_TRUNCATE,
  128. USERFS_REQ_OPENDIR,
  129. USERFS_REQ_CLOSEDIR,
  130. USERFS_REQ_READDIR,
  131. USERFS_REQ_REWINDDIR,
  132. USERFS_REQ_STATFS,
  133. USERFS_REQ_UNLINK,
  134. USERFS_REQ_MKDIR,
  135. USERFS_REQ_RMDIR,
  136. USERFS_REQ_RENAME,
  137. USERFS_REQ_STAT,
  138. USERFS_REQ_DESTROY
  139. };
  140. /* This enumeration provides the type of each response returned from the
  141. * user file system to OS file system client.
  142. */
  143. enum userfs_resp_e
  144. {
  145. USERFS_RESP_OPEN = 0,
  146. USERFS_RESP_CLOSE,
  147. USERFS_RESP_READ,
  148. USERFS_RESP_WRITE,
  149. USERFS_RESP_SEEK,
  150. USERFS_RESP_IOCTL,
  151. USERFS_RESP_SYNC,
  152. USERFS_RESP_DUP,
  153. USERFS_RESP_FSTAT,
  154. USERFS_RESP_OPENDIR,
  155. USERFS_RESP_CLOSEDIR,
  156. USERFS_RESP_READDIR,
  157. USERFS_RESP_REWINDDIR,
  158. USERFS_RESP_STATFS,
  159. USERFS_RESP_UNLINK,
  160. USERFS_RESP_MKDIR,
  161. USERFS_RESP_RMDIR,
  162. USERFS_RESP_RENAME,
  163. USERFS_RESP_STAT,
  164. USERFS_RESP_DESTROY
  165. };
  166. /* These structures are used by internal UserFS implementation and should not
  167. * be of interest to application level logic.
  168. *
  169. * This is passed to the mount() function as optional data when the UserFS
  170. * file system is mounted.
  171. */
  172. struct userfs_config_s
  173. {
  174. size_t mxwrite; /* The max size of a write data */
  175. uint16_t portno; /* The server port number (host order) */
  176. };
  177. /* This structure identifies the user-space file system operations. */
  178. struct stat; /* Forward reference */
  179. struct statfs; /* Forward reference */
  180. struct userfs_operations_s
  181. {
  182. int (*open)(FAR void *volinfo, FAR const char *relpath,
  183. int oflags, mode_t mode, FAR void **openinfo);
  184. int (*close)(FAR void *volinfo, FAR void *openinfo);
  185. ssize_t (*read)(FAR void *volinfo, FAR void *openinfo,
  186. FAR char *buffer, size_t buflen);
  187. ssize_t (*write)(FAR void *volinfo, FAR void *openinfo,
  188. FAR const char *buffer, size_t buflen);
  189. off_t (*seek)(FAR void *volinfo, FAR void *openinfo, off_t offset,
  190. int whence);
  191. int (*ioctl)(FAR void *volinfo, FAR void *openinfo, int cmd,
  192. unsigned long arg);
  193. int (*sync)(FAR void *volinfo, FAR void *openinfo);
  194. int (*dup)(FAR void *volinfo, FAR void *oldinfo, FAR void **newinfo);
  195. int (*fstat)(FAR void *volinfo, FAR void *openinfo,
  196. FAR struct stat *buf);
  197. int (*truncate)(FAR void *volinfo, FAR void *openinfo, off_t length);
  198. int (*opendir)(FAR void *volinfo, FAR const char *relpath,
  199. FAR void **dir);
  200. int (*closedir)(FAR void *volinfo, FAR void *dir);
  201. int (*readdir)(FAR void *volinfo, FAR void *dir,
  202. FAR struct dirent *entry);
  203. int (*rewinddir)(FAR void *volinfo, FAR void *dir);
  204. int (*statfs)(FAR void *volinfo, FAR struct statfs *buf);
  205. int (*unlink)(FAR void *volinfo, FAR const char *relpath);
  206. int (*mkdir)(FAR void *volinfo, FAR const char *relpath, mode_t mode);
  207. int (*rmdir)(FAR void *volinfo, FAR const char *relpath);
  208. int (*rename)(FAR void *volinfo, FAR const char *oldrelpath,
  209. FAR const char *newrelpath);
  210. int (*stat)(FAR void *volinfo, FAR const char *relpath,
  211. FAR struct stat *buf);
  212. int (*destroy)(FAR void *volinfo);
  213. };
  214. /* The following structures describe the header on the marshaled data sent
  215. * on the FIFOs. See struct userfs_operations_s for the form of the
  216. * marshaled function calls.
  217. */
  218. struct userfs_open_request_s
  219. {
  220. uint8_t req; /* Must be USERFS_REQ_OPEN */
  221. int oflags; /* Open flags */
  222. mode_t mode; /* Open mode */
  223. char relpath[1]; /* Mountpoint relative path to the file to open */
  224. };
  225. #define SIZEOF_USERFS_OPEN_REQUEST_S(n) (sizeof(struct userfs_open_request_s) + (n) - 1)
  226. struct userfs_open_response_s
  227. {
  228. uint8_t resp; /* Must be USERFS_RESP_OPEN */
  229. FAR void *openinfo; /* Open file info for use in other operations */
  230. int ret; /* Result of the operation */
  231. };
  232. struct userfs_close_request_s
  233. {
  234. uint8_t req; /* Must be USERFS_REQ_CLOSE */
  235. FAR void *openinfo; /* Open file info as returned by open() */
  236. };
  237. struct userfs_close_response_s
  238. {
  239. uint8_t resp; /* Must be USERFS_RESP_CLOSE */
  240. int ret; /* Result of the operation */
  241. };
  242. struct userfs_read_request_s
  243. {
  244. uint8_t req; /* Must be USERFS_REQ_READ */
  245. FAR void *openinfo; /* Open file info as returned by open() */
  246. size_t readlen; /* Maximum number of bytes to read */
  247. };
  248. struct userfs_read_response_s
  249. {
  250. uint8_t resp; /* Must be USERFS_RESP_READ */
  251. ssize_t nread; /* Result of the operation */
  252. char rddata[1]; /* Read data follows. Actual size is nread */
  253. };
  254. #define SIZEOF_USERFS_READ_RESPONSE_S(n) (sizeof(struct userfs_read_response_s) + (n) - 1)
  255. struct userfs_write_request_s
  256. {
  257. uint8_t req; /* Must be USERFS_REQ_WRITE */
  258. FAR void *openinfo; /* Open file info as returned by open() */
  259. size_t writelen; /* Number of bytes to write */
  260. char wrdata[1]; /* Read data follows. Actual size is wrsize */
  261. };
  262. #define SIZEOF_USERFS_WRITE_REQUEST_S(n) (sizeof(struct userfs_write_request_s) + (n) - 1)
  263. struct userfs_write_response_s
  264. {
  265. uint8_t resp; /* Must be USERFS_RESP_WRITE */
  266. ssize_t nwritten; /* Result of the operation */
  267. };
  268. struct userfs_seek_request_s
  269. {
  270. uint8_t req; /* Must be USERFS_REQ_SEEK */
  271. FAR void *openinfo; /* Open file info as returned by open() */
  272. off_t offset; /* Seek offset */
  273. int whence; /* Determines how offset is interpreted */
  274. };
  275. struct userfs_seek_response_s
  276. {
  277. uint8_t resp; /* Must be USERFS_RESP_SEEK */
  278. off_t ret; /* Result of the operation */
  279. };
  280. struct userfs_ioctl_request_s
  281. {
  282. uint8_t req; /* Must be USERFS_REQ_IOCTL */
  283. FAR void *openinfo; /* Open file info as returned by open() */
  284. int cmd; /* IOCTL command */
  285. unsigned long arg; /* Argument that accompanies the command */
  286. };
  287. struct userfs_ioctl_response_s
  288. {
  289. uint8_t resp; /* Must be USERFS_RESP_IOCTL */
  290. int ret; /* Result of the operation */
  291. };
  292. struct userfs_sync_request_s
  293. {
  294. uint8_t req; /* Must be USERFS_REQ_SYNC */
  295. FAR void *openinfo; /* Open file info as returned by open() */
  296. };
  297. struct userfs_sync_response_s
  298. {
  299. uint8_t resp; /* Must be USERFS_RESP_SYNC */
  300. int ret; /* Result of the operation */
  301. };
  302. struct userfs_dup_request_s
  303. {
  304. uint8_t req; /* Must be USERFS_REQ_DUP */
  305. FAR void *openinfo; /* Open file info as returned by open() */
  306. };
  307. struct userfs_dup_response_s
  308. {
  309. uint8_t resp; /* Must be USERFS_RESP_DUP */
  310. FAR void *openinfo; /* Open file info for the dup'ed file */
  311. int ret; /* Result of the operation */
  312. };
  313. struct userfs_fstat_request_s
  314. {
  315. uint8_t req; /* Must be USERFS_REQ_FSTAT */
  316. FAR void *openinfo; /* Open file info as returned by open() */
  317. };
  318. struct userfs_fstat_response_s
  319. {
  320. uint8_t resp; /* Must be USERFS_RESP_FSTAT */
  321. int ret; /* Result of the operation */
  322. FAR struct stat buf; /* Returned file system status */
  323. };
  324. struct userfs_truncate_request_s
  325. {
  326. uint8_t req; /* Must be USERFS_REQ_TRUNCATE */
  327. FAR void *openinfo; /* Open file info as returned by open() */
  328. off_t length; /* New length of the file */
  329. };
  330. struct userfs_truncate_response_s
  331. {
  332. uint8_t resp; /* Must be USERFS_RESP_FSTAT */
  333. int ret; /* Result of the operation */
  334. };
  335. struct userfs_opendir_request_s
  336. {
  337. uint8_t req; /* Must be USERFS_REQ_OPENDIR */
  338. char relpath[1]; /* Mountpoint relative path to the directory to open */
  339. };
  340. #define SIZEOF_USERFS_OPENDIR_REQUEST_S(n) (sizeof(struct userfs_opendir_request_s) + (n) - 1)
  341. struct userfs_opendir_response_s
  342. {
  343. uint8_t resp; /* Must be USERFS_RESP_OPENDIR */
  344. int ret; /* Result of the operation */
  345. FAR void *dir; /* Opaque pointer to directory information */
  346. };
  347. struct userfs_closedir_request_s
  348. {
  349. uint8_t req; /* Must be USERFS_REQ_CLOSEDIR */
  350. FAR void *dir; /* Opaque pointer to directory information */
  351. };
  352. struct userfs_closedir_response_s
  353. {
  354. uint8_t resp; /* Must be USERFS_RESP_CLOSEDIR */
  355. int ret; /* Result of the operation */
  356. };
  357. struct userfs_readdir_request_s
  358. {
  359. uint8_t req; /* Must be USERFS_REQ_READDIR */
  360. FAR void *dir; /* Opaque pointer to directory information */
  361. };
  362. struct userfs_readdir_response_s
  363. {
  364. uint8_t resp; /* Must be USERFS_RESP_READDIR */
  365. int ret; /* Result of the operation */
  366. struct dirent entry; /* Directory entry that was read */
  367. };
  368. struct userfs_rewinddir_request_s
  369. {
  370. uint8_t req; /* Must be USERFS_REQ_REWINDDIR */
  371. FAR void *dir; /* Opaque pointer to directory information */
  372. };
  373. struct userfs_rewinddir_response_s
  374. {
  375. uint8_t resp; /* Must be USERFS_RESP_REWINDDIR */
  376. int ret; /* Result of the operation */
  377. };
  378. struct userfs_statfs_request_s
  379. {
  380. uint8_t req; /* Must be USERFS_REQ_STATFS */
  381. };
  382. struct userfs_statfs_response_s
  383. {
  384. uint8_t resp; /* Must be USERFS_RESP_STATFS */
  385. int ret; /* Result of the operation */
  386. FAR struct statfs buf; /* Returned file system status */
  387. };
  388. struct userfs_unlink_request_s
  389. {
  390. uint8_t req; /* Must be USERFS_REQ_UNLINK */
  391. char relpath[1]; /* Relative path to the entry to unlink */
  392. };
  393. #define SIZEOF_USERFS_UNLINK_REQUEST_S(n) (sizeof(struct userfs_unlink_request_s) + (n) - 1)
  394. struct userfs_unlink_response_s
  395. {
  396. uint8_t resp; /* Must be USERFS_RESP_UNLINK */
  397. int ret; /* Result of the operation */
  398. };
  399. struct userfs_mkdir_request_s
  400. {
  401. uint8_t req; /* Must be USERFS_REQ_MKDIR */
  402. mode_t mode; /* Directory mode flags */
  403. char relpath[1]; /* Relative path to the directory to create */
  404. };
  405. #define SIZEOF_USERFS_MKDIR_REQUEST_S(n) (sizeof(struct userfs_mkdir_request_s) + (n) - 1)
  406. struct userfs_mkdir_response_s
  407. {
  408. uint8_t resp; /* Must be USERFS_RESP_MKDIR */
  409. int ret; /* Result of the operation */
  410. };
  411. struct userfs_rmdir_request_s
  412. {
  413. uint8_t req; /* Must be USERFS_REQ_RMDIR */
  414. char relpath[1]; /* Relative path to the directory to remove */
  415. };
  416. #define SIZEOF_USERFS_RMDIR_REQUEST_S(n) (sizeof(struct userfs_rmdir_request_s) + (n) - 1)
  417. struct userfs_rmdir_response_s
  418. {
  419. uint8_t resp; /* Must be USERFS_RESP_RMDIR */
  420. int ret; /* Result of the operation */
  421. };
  422. struct userfs_rename_request_s
  423. {
  424. uint8_t req; /* Must be USERFS_REQ_RENAME */
  425. uint16_t newoffset; /* Offset from old to new relpath */
  426. char oldrelpath[1]; /* Old relative path to be renamed */
  427. };
  428. #define SIZEOF_USERFS_RENAME_REQUEST_S(o,n) (sizeof(struct userfs_rename_request_s) + (o) + (n))
  429. struct userfs_rename_response_s
  430. {
  431. uint8_t resp; /* Must be USERFS_RESP_RENAME */
  432. int ret; /* Result of the operation */
  433. };
  434. struct userfs_stat_request_s
  435. {
  436. uint8_t req; /* Must be USERFS_REQ_STAT */
  437. char relpath[1]; /* Relative path to the directory entry to be queried */
  438. };
  439. #define SIZEOF_USERFS_STAT_REQUEST_S(n) (sizeof(struct userfs_stat_request_s) + (n) - 1)
  440. struct userfs_stat_response_s
  441. {
  442. uint8_t resp; /* Must be USERFS_RESP_STAT */
  443. int ret; /* Result of the operation */
  444. FAR struct stat buf; /* Returned status of the directory entry */
  445. };
  446. struct userfs_destroy_request_s
  447. {
  448. uint8_t req; /* Must be USERFS_REQ_DESTROY */
  449. };
  450. struct userfs_destroy_response_s
  451. {
  452. uint8_t resp; /* Must be USERFS_RESP_DESTROY */
  453. int ret; /* Result of the operation */
  454. };
  455. /****************************************************************************
  456. * Public Function Prototypes
  457. ****************************************************************************/
  458. #ifdef __cplusplus
  459. #define EXTERN extern "C"
  460. extern "C"
  461. {
  462. #else
  463. #define EXTERN extern
  464. #endif
  465. /****************************************************************************
  466. * Name: userfs_register
  467. *
  468. * Description:
  469. * Register the UserFS factory driver at dev/userfs.
  470. *
  471. * NOTE: This is an OS internal function that should not be called from
  472. * application logic.
  473. *
  474. * Input Parameters:
  475. * None
  476. *
  477. * Returned Value:
  478. * Zero (OK) is returned if the dev/userfs driver was initialized and
  479. * registered properly. Otherwise, a negated errno value is returned
  480. * to indicate the nature of the failure.
  481. *
  482. ****************************************************************************/
  483. int userfs_register(void);
  484. /****************************************************************************
  485. * Name: userfs_run
  486. *
  487. * Description:
  488. * Start the UserFS server on the current thread. This function will mount
  489. * the UserFS file system and will not return until that file system has
  490. * been unmounted.
  491. *
  492. * userfs_run() implements the UserFS server. It performs there operations:
  493. *
  494. * 1. It configures and creates the UserFS file system and
  495. * 2. Mounts the user file system at the provide mount point path.
  496. * 2. Receives file system requests on the LocalHost socket with
  497. * server port 0x83nn where nn is the same as above,
  498. * 3. Received file system requests are marshaled and dispatch to the
  499. * user file system via callbacks to the operations provided by
  500. * "userops", and
  501. * 3. Returns file system responses generated by the callbacks to the
  502. * LocalHost client socket.
  503. *
  504. * NOTE: This is a user function that is implemented as part of the
  505. * NuttX C library and is intended to be called by application logic.
  506. *
  507. * Input Parameters:
  508. * mountpt - Mountpoint path
  509. * userops - The caller operations that implement the file system
  510. * interface.
  511. * volinfo - Private volume data that will be provided in all struct
  512. * userfs_operations_s methods.
  513. * mxwrite - The max size of a write data
  514. *
  515. * Returned Value:
  516. * This function does not return unless the file system is unmounted (OK)
  517. * or unless an error is encountered. In the event of an error, the
  518. * returned value is a negated errno value indicating the nature of the
  519. * error.
  520. *
  521. ****************************************************************************/
  522. int userfs_run(FAR const char *mountpt,
  523. FAR const struct userfs_operations_s *userops,
  524. FAR void *volinfo, size_t mxwrite);
  525. #undef EXTERN
  526. #ifdef __cplusplus
  527. }
  528. #endif
  529. #endif /* CONFIG_FS_USERFS */
  530. #endif /* __INCLUDE_NUTTX_FS_USERFSFS_H */