00001 00008 #include "sceptre.h" 00009 #include "device.h" 00010 #include <reent.h> 00011 #include <errno.h> 00012 #include <string.h> 00013 00014 00023 int _link_r(struct _reent *p_reent, const char *p_old, const char *p_new) 00024 { 00025 /* TODO, not converted for Sceptre yet. 00026 int len, idx; 00027 struct IOCTLRENAMESTRUCT 00028 { 00029 const char * oldname; 00030 const char * newname; 00031 } 00032 IOCTL_RENAME; 00033 00034 // All devices must start with a name and name is bracketed with '/'. 00035 if (p_old[0]=='/') 00036 { 00037 // We might have a valid device name, search the table list. 00038 for (idx=0; device_table_list[idx].p_item; idx++) 00039 { 00040 len = strlen(device_table_list[idx].p_item->name); 00041 if (strncmp(device_table_list[idx].p_item->name,&p_old[1],len)==0) 00042 { 00043 // Ensure trailing '/'. 00044 if (p_old[len+1]!='/') continue; 00045 // Found it, now call the open. 00046 // Device is called with device name removed. 00047 if (device_table_list[idx].p_item->ioctl!=0) 00048 { 00049 IOCTL_RENAME.oldname = &p_old[len+2]; 00050 IOCTL_RENAME.newname = p_new; 00051 return device_table_list[idx].p_item->ioctl(r,0,IOCTL_MMC_RENAME,&IOCTL_RENAME); 00052 } 00053 } 00054 } 00055 }*/ 00056 00057 // Otherwise we get nasty about it.. 00058 p_reent->_errno = EINVAL; 00059 return -1; 00060 } 00061