Fix confusing output of mknod
Context: mknod does not return a file descriptor.master
parent
3a34b2efb7
commit
9da36abaca
|
@ -436,19 +436,15 @@ void *POSIX_Create(char *testFileName, IOR_param_t * param)
|
|||
/*
|
||||
* Creat a file through mknod interface.
|
||||
*/
|
||||
void *POSIX_Mknod(char *testFileName)
|
||||
int POSIX_Mknod(char *testFileName)
|
||||
{
|
||||
int *fd;
|
||||
int ret;
|
||||
|
||||
fd = (int *)malloc(sizeof(int));
|
||||
if (fd == NULL)
|
||||
ERR("Unable to malloc file descriptor");
|
||||
ret = mknod(testFileName, S_IFREG | S_IRUSR, 0);
|
||||
if (ret < 0)
|
||||
ERR("mknod failed");
|
||||
|
||||
*fd = mknod(testFileName, S_IFREG | S_IRUSR, 0);
|
||||
if (*fd < 0)
|
||||
ERR("mknod failed");
|
||||
|
||||
return ((void *)fd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -68,7 +68,7 @@ typedef struct ior_aiori {
|
|||
char *name;
|
||||
char *name_legacy;
|
||||
void *(*create)(char *, IOR_param_t *);
|
||||
void *(*mknod)(char *);
|
||||
int (*mknod)(char *);
|
||||
void *(*open)(char *, IOR_param_t *);
|
||||
IOR_offset_t (*xfer)(int, void *, IOR_size_t *,
|
||||
IOR_offset_t, IOR_param_t *);
|
||||
|
@ -131,7 +131,7 @@ int aiori_posix_access (const char *path, int mode, IOR_param_t * param);
|
|||
int aiori_posix_stat (const char *path, struct stat *buf, IOR_param_t * param);
|
||||
|
||||
void *POSIX_Create(char *testFileName, IOR_param_t * param);
|
||||
void *POSIX_Mknod(char *testFileName);
|
||||
int POSIX_Mknod(char *testFileName);
|
||||
void *POSIX_Open(char *testFileName, IOR_param_t * param);
|
||||
IOR_offset_t POSIX_GetFileSize(IOR_param_t * test, MPI_Comm testComm, char *testFileName);
|
||||
void POSIX_Delete(char *testFileName, IOR_param_t * param);
|
||||
|
|
40
src/mdtest.c
40
src/mdtest.c
|
@ -345,7 +345,7 @@ static void remove_file (const char *path, uint64_t itemNum) {
|
|||
|
||||
static void create_file (const char *path, uint64_t itemNum) {
|
||||
char curr_item[MAX_PATHLEN];
|
||||
void *aiori_fh;
|
||||
void *aiori_fh = NULL;
|
||||
|
||||
if ( (itemNum % ITEM_COUNT==0 && (itemNum != 0))) {
|
||||
VERBOSE(3,5,"create file: "LLU"", itemNum);
|
||||
|
@ -355,36 +355,36 @@ static void create_file (const char *path, uint64_t itemNum) {
|
|||
sprintf(curr_item, "%s/file.%s"LLU"", path, mk_name, itemNum);
|
||||
VERBOSE(3,5,"create_remove_items_helper (non-dirs create): curr_item is '%s'", curr_item);
|
||||
|
||||
if (collective_creates) {
|
||||
param.openFlags = IOR_WRONLY;
|
||||
param.openFlags = IOR_WRONLY;
|
||||
|
||||
if (make_node) {
|
||||
int ret;
|
||||
VERBOSE(3,5,"create_remove_items_helper : mknod..." );
|
||||
|
||||
ret = backend->mknod (curr_item);
|
||||
if (ret != 0)
|
||||
FAIL("unable to mknode file %s", curr_item);
|
||||
|
||||
return;
|
||||
} else if (collective_creates) {
|
||||
VERBOSE(3,5,"create_remove_items_helper (collective): open..." );
|
||||
|
||||
if (make_node)
|
||||
aiori_fh = backend->mknod (curr_item);
|
||||
else
|
||||
aiori_fh = backend->open (curr_item, ¶m);
|
||||
if (NULL == aiori_fh) {
|
||||
aiori_fh = backend->open (curr_item, ¶m);
|
||||
if (NULL == aiori_fh)
|
||||
FAIL("unable to open file %s", curr_item);
|
||||
}
|
||||
|
||||
/*
|
||||
* !collective_creates
|
||||
*/
|
||||
} else {
|
||||
param.openFlags = IOR_CREAT | IOR_WRONLY;
|
||||
param.openFlags |= IOR_CREAT;
|
||||
param.filePerProc = !shared_file;
|
||||
param.mode = FILEMODE;
|
||||
|
||||
param.mode = FILEMODE;
|
||||
VERBOSE(3,5,"create_remove_items_helper (non-collective, shared): open..." );
|
||||
|
||||
if (make_node)
|
||||
aiori_fh = backend->mknod (curr_item);
|
||||
else
|
||||
aiori_fh = backend->create (curr_item, ¶m);
|
||||
if (NULL == aiori_fh) {
|
||||
aiori_fh = backend->create (curr_item, ¶m);
|
||||
if (NULL == aiori_fh)
|
||||
FAIL("unable to create file %s", curr_item);
|
||||
}
|
||||
}
|
||||
|
||||
if (write_bytes > 0) {
|
||||
|
@ -402,9 +402,7 @@ static void create_file (const char *path, uint64_t itemNum) {
|
|||
}
|
||||
|
||||
VERBOSE(3,5,"create_remove_items_helper: close..." );
|
||||
|
||||
if (!make_node)
|
||||
backend->close (aiori_fh, ¶m);
|
||||
backend->close (aiori_fh, ¶m);
|
||||
}
|
||||
|
||||
/* helper for creating/removing items */
|
||||
|
|
Loading…
Reference in New Issue