Subversion Repositories HelenOS

Rev

Rev 2846 | Rev 2852 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2846 Rev 2847
Line 140... Line 140...
140
    unsigned next = IPC_GET_ARG1(*request);
140
    unsigned next = IPC_GET_ARG1(*request);
141
    unsigned last = IPC_GET_ARG2(*request);
141
    unsigned last = IPC_GET_ARG2(*request);
142
    dev_handle_t dev_handle = IPC_GET_ARG3(*request);
142
    dev_handle_t dev_handle = IPC_GET_ARG3(*request);
143
    int lflag = IPC_GET_ARG4(*request);
143
    int lflag = IPC_GET_ARG4(*request);
144
    fs_index_t index = IPC_GET_ARG5(*request); /* when L_LINK specified */
144
    fs_index_t index = IPC_GET_ARG5(*request); /* when L_LINK specified */
-
 
145
    char component[NAME_MAX + 1];
-
 
146
    int len;
145
 
147
 
146
    if (last < next)
148
    if (last < next)
147
        last += PLB_SIZE;
149
        last += PLB_SIZE;
148
 
150
 
149
    void *par = NULL;
151
    void *par = NULL;
150
    void *cur = ops->root_get(dev_handle);
152
    void *cur = ops->root_get(dev_handle);
151
 
153
 
152
    if (ops->plb_get_char(next) == '/')
154
    if (ops->plb_get_char(next) == '/')
153
        next++;     /* eat slash */
155
        next++;     /* eat slash */
154
   
156
   
155
    char component[NAME_MAX + 1];
-
 
156
    int len = 0;
-
 
157
    while (ops->has_children(cur) && next <= last) {
157
    while (ops->has_children(cur) && next <= last) {
158
        void *tmp;
158
        void *tmp;
159
 
159
 
160
        /* collect the component */
160
        /* collect the component */
-
 
161
        len = 0;
161
        while ((ops->plb_get_char(next) != '/') && (next <= last)) {
162
        while ((ops->plb_get_char(next) != '/') && (next <= last)) {
162
            if (len + 1 == NAME_MAX) {
163
            if (len + 1 == NAME_MAX) {
163
                /* comopnent length overflow */
164
                /* comopnent length overflow */
164
                ipc_answer_0(rid, ENAMETOOLONG);
165
                ipc_answer_0(rid, ENAMETOOLONG);
165
                return;
166
                return;
Line 169... Line 170...
169
        }
170
        }
170
 
171
 
171
        assert(len);
172
        assert(len);
172
        component[len] = '\0';
173
        component[len] = '\0';
173
        next++;     /* eat slash */
174
        next++;     /* eat slash */
174
        len = 0;
-
 
175
 
175
 
176
        /* match the component */
176
        /* match the component */
177
        tmp = ops->match(cur, component);
177
        tmp = ops->match(cur, component);
178
 
178
 
179
        /* handle miss: match amongst siblings */
179
        /* handle miss: match amongst siblings */
Line 234... Line 234...
234
                ipc_answer_0(rid, ENOTDIR);
234
                ipc_answer_0(rid, ENOTDIR);
235
                return;
235
                return;
236
            }
236
            }
237
 
237
 
238
            /* collect next component */
238
            /* collect next component */
-
 
239
            len = 0;
239
            while (next <= last) {
240
            while (next <= last) {
240
                if (ops->plb_get_char(next) == '/') {
241
                if (ops->plb_get_char(next) == '/') {
241
                    /* more than one component */
242
                    /* more than one component */
242
                    ipc_answer_0(rid, ENOENT);
243
                    ipc_answer_0(rid, ENOENT);
243
                    return;
244
                    return;
Line 250... Line 251...
250
                component[len++] = ops->plb_get_char(next);
251
                component[len++] = ops->plb_get_char(next);
251
                next++; /* process next character */
252
                next++; /* process next character */
252
            }
253
            }
253
            assert(len);
254
            assert(len);
254
            component[len] = '\0';
255
            component[len] = '\0';
255
            len = 0;
-
 
256
               
256
               
257
            void *nodep;
257
            void *nodep;
258
            if (lflag & L_CREATE)
258
            if (lflag & L_CREATE)
259
                nodep = ops->create(lflag);
259
                nodep = ops->create(lflag);
260
            else
260
            else