int File_GetStripeByDirFd( int dirfd, const char *fname, stripe_info_t * p_stripe_info, stripe_items_t * p_stripe_items ) { int rc = 0; char lum_buffer[4096]; struct lov_user_md *p_lum = ( struct lov_user_md * ) lum_buffer; if ( !fname|| !fname[0] ) return -EFAULT; memset( lum_buffer, 0, sizeof( lum_buffer ) ); strcpy((char *)p_lum, fname); if (ioctl(dirfd, IOC_MDC_GETFILESTRIPE, (void *)p_lum) == -1) rc = -errno; if ( rc != 0 ) { if ( rc == -ENODATA ) DisplayLog( LVL_DEBUG, TAG_STRIPE, "File %s has no stripe information", fname ); else if ( ( rc != -ENOENT ) && ( rc != -ESTALE ) ) DisplayLog( LVL_CRIT, TAG_STRIPE, "Error %d getting stripe info for %s", rc, fname ); return rc; } return fill_stripe_info(p_lum, p_stripe_info, p_stripe_items); }
int File_GetStripeByPath( const char *entry_path, stripe_info_t * p_stripe_info, stripe_items_t * p_stripe_items ) { int rc; struct lov_user_md *p_lum; if ( !entry_path || !entry_path[0] ) return -EFAULT; p_lum = (struct lov_user_md *)MemAlloc(LUM_SIZE_MAX); if (!p_lum) return -ENOMEM; memset(p_lum, 0, LUM_SIZE_MAX); rc = llapi_file_get_stripe(entry_path, p_lum); if ( rc != 0 ) { if ( rc == -ENODATA ) DisplayLog( LVL_DEBUG, TAG_STRIPE, "File %s has no stripe information", entry_path ); else if ( ( rc != -ENOENT ) && ( rc != -ESTALE ) ) DisplayLog( LVL_CRIT, TAG_STRIPE, "Error %d getting stripe info for %s", rc, entry_path ); goto out_free; } rc = fill_stripe_info(p_lum, p_stripe_info, p_stripe_items); out_free: MemFree(p_lum); return rc; }
int File_GetStripeByDirFd(int dirfd, const char *fname, stripe_info_t *p_stripe_info, stripe_items_t *p_stripe_items) { int rc = 0; struct lov_user_md *p_lum; if (!fname|| !fname[0]) return -EFAULT; p_lum = MemAlloc(LUM_SIZE_MAX); if (!p_lum) return -ENOMEM; strcpy((char *)p_lum, fname); rc = ioctl(dirfd, IOC_MDC_GETFILESTRIPE, p_lum); if (rc == 0) { rc = fill_stripe_info(p_lum, p_stripe_info, p_stripe_items); } else { rc = -errno; if (rc == -ENODATA) { DisplayLog(LVL_DEBUG, TAG_STRIPE, "File %s has no stripe information", fname); set_empty_stripe(p_stripe_info, p_stripe_items); rc = 0; } else if ((rc != -ENOENT) && (rc != -ESTALE)) { DisplayLog(LVL_CRIT, TAG_STRIPE, "Error %d getting stripe info for %s", rc, fname); } } MemFree(p_lum); return rc; }