26.02.2014 Views

Getting Started with QNX Neutrino - QNX Software Systems

Getting Started with QNX Neutrino - QNX Software Systems

Getting Started with QNX Neutrino - QNX Software Systems

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Alphabetical listing of connect and I/O functions<br />

© 2009, <strong>QNX</strong> <strong>Software</strong> <strong>Systems</strong> GmbH & Co. KG.<br />

Returns: The status via the helper macro _RESMGR_STATUS and the data via message<br />

reply.<br />

io_rename()<br />

int io_rename (resmgr_context_t *ctp, io_rename_t *msg,<br />

RESMGR_HANDLE_T *handle, io_rename_extra_t *extra)<br />

Classification: Connect<br />

Default handler: none<br />

Helper functions: iofunc_rename()<br />

Client function: rename()<br />

Messages: _IO_CONNECT <strong>with</strong> subtype _IO_CONNECT_RENAME<br />

Data structure:<br />

struct _io_connect {<br />

// internal fields (as described above)<br />

uint16_t path_len;<br />

uint8_t extra_type;<br />

uint16_t extra_len;<br />

char path [1];<br />

};<br />

struct _io_connect_link_reply {<br />

uint32_t reserved1 [2];<br />

uint8_t eflag;<br />

uint8_t reserved2 [3];<br />

uint32_t umask;<br />

uint16_t nentries;<br />

uint16_t path_len;<br />

};<br />

typedef union _io_rename_extra {<br />

char path [1];<br />

} io_rename_extra_t;<br />

typedef union {<br />

struct _io_connect<br />

connect;<br />

struct _io_connect_link_reply link_reply;<br />

} io_rename_t;<br />

Description: Performs the rename operation, given the new name in path and the<br />

original name in the path member of the passed extra parameter. Implementation note:<br />

the pathname of the original name is given (rather than an OCB) specifically for the<br />

case of handling a rename of a file that’s hard-linked to another file. If the OCB were<br />

given, there would be no way to tell apart the two (or more) versions of the<br />

hard-linked file.<br />

This function will be called only <strong>with</strong> two filenames that are on the same filesystem<br />

(same device). Therefore, there’s no need to check for a case where you’d return<br />

EXDEV. This doesn’t prevent you from returning EXDEV if you don’t wish to perform<br />

the rename() yourself (for example, it may be very complicated to do the rename<br />

operation from one directory to another). In the case of returning EXDEV, the shell<br />

246 Chapter 5 • Resource Managers April 30, 2009

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!