Skip to content

Commit

Permalink
wip2
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbird committed Mar 9, 2024
1 parent 16e3b36 commit 725fb3e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 20 deletions.
16 changes: 3 additions & 13 deletions kernel/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,17 +156,15 @@ BYTE remote_getfree_11a3(void FAR *cds, void *dst)
return SUCCESS;
}

BYTE remote_getvolumeinfo(UBYTE drive, UBYTE bufsiz, void *dst_r, char FAR *dst_s)
BYTE remote_getvolumeinfo(UBYTE drive, struct xgetvolumeinfo *s)
{
UWORD *udst = (UWORD *)dst_r;
iregs regs = {};
struct xgetvolumeinfo s;
struct xgetvolumeinfo FAR *p;

p = MK_FAR(s);
p = MK_FAR(*s);

regs.a.x = 0x11a0;
regs.c.x = sizeof(s);
regs.c.x = sizeof(*s);
regs.d.b.l = drive;
regs.d.b.h = 1; /* we'd like a version one structure returned */
regs.es = FP_SEG_OBJ(&regs, p);
Expand All @@ -177,13 +175,5 @@ BYTE remote_getvolumeinfo(UBYTE drive, UBYTE bufsiz, void *dst_r, char FAR *dst_
if ((regs.flags & FLG_CARRY) || (regs.a.x != 0x1c01))
return DE_INVLDFUNC;

if (bufsiz < s.namelen + 1)
return DE_INVLDBUF;

udst[0] = s.flags.std;
udst[1] = s.flags.ext;
udst[2] = s.maxfilenamelen;
udst[3] = s.maxpathlen;
n_fmemcpy(dst_s, s.name, s.namelen + 1);
return SUCCESS;
}
14 changes: 8 additions & 6 deletions kernel/newstuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,14 +661,16 @@ COUNT DosGetVolumeInfo(const char FAR *DriveString, UBYTE bufsiz, UWORD *outv, c

if (cdsp->cdsFlags & CDSNETWDRV) /* Try redirector extension */
{
UWORD rg[4];
rc = remote_getvolumeinfo(drive, bufsiz, rg, name);
struct xgetvolumeinfo xg;
rc = remote_getvolumeinfo(drive, &xg);
if (rc == SUCCESS)
{
outv[0] = rg[0];
/* caller doesn't need extended flags */
outv[1] = rg[2];
outv[2] = rg[3];
outv[0] = xg.flags.std;
outv[1] = xg.maxfilenamelen;
outv[2] = xg.maxpathlen;
if (bufsiz < xg.namelen + 1)
return DE_INVLDBUF;
n_fmemcpy(name, xg.name, xg.namelen + 1);
}
return rc;
}
Expand Down
2 changes: 1 addition & 1 deletion kernel/proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ BYTE remote_qualify_filename(__FAR(char) dst, __FAR(const char) src);
#define remote_rw(cmd,s,arg) network_redirector_mx(cmd, s, arg)
BYTE remote_getfree(__FAR(void) cds, void *dst);
BYTE remote_getfree_11a3(__FAR(void) cds, void *dst);
BYTE remote_getvolumeinfo(UBYTE drive, UBYTE bufsiz, void *dst_r, __FAR(char) dst_s);
BYTE remote_getvolumeinfo(UBYTE drive, struct xgetvolumeinfo *s);
UDWORD remote_lseek(__FAR(void) sft, DWORD new_pos);
UWORD remote_getfattr(void);
#define remote_setfattr(attr) (WORD)network_redirector_mx(REM_SETATTR, NULL, attr)
Expand Down

4 comments on commit 725fb3e

@stsp
Copy link

@stsp stsp commented on 725fb3e Mar 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So why it doesn't compile?

@andrewbird
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang++ -Isubprojects/libfdpp/libfdpp.so.35.10.p -Isubprojects/libfdpp -I../subprojects/libfdpp -I../subprojects/libfdpp/src -I../subprojects/libfdpp/hdr -I../subprojects/libfdpp/include/fdpp -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++20 -O0 -g -fPIC -DFDPP -DDEBUG -DWITHFAT32 -DCLANG_VER=14 -fno-threadsafe-statics -Werror=packed-non-pod -Wno-unknown-warning-option -Wno-format-invalid-specifier -Wno-c99-designator -DFDPP_DEBUG -DEXTRA_DEBUG -fdebug-macro -MD -MQ subprojects/libfdpp/libfdpp.so.35.10.p/meson-generated_network.cc.o -MF subprojects/libfdpp/libfdpp.so.35.10.p/meson-generated_network.cc.o.d -o subprojects/libfdpp/libfdpp.so.35.10.p/meson-generated_network.cc.o -c subprojects/libfdpp/libfdpp.so.35.10.p/network.cc
In file included from subprojects/libfdpp/libfdpp.so.35.10.p/network.cc:30:
In file included from ../subprojects/libfdpp/hdr/portab.h:167:
../subprojects/libfdpp/farptr.hpp:152:15: error: 'operator type-parameter-0-0 *' declared as a pointer to a reference of type 'xgetvolumeinfo &'
    operator T*() const {
              ^
../subprojects/libfdpp/farptr.hpp:239:23: note: in instantiation of template class 'FarPtrBase<xgetvolumeinfo &>' requested here
class FarPtr : public FarPtrBase<T>
                      ^
subprojects/libfdpp/libfdpp.so.35.10.p/network.cc:164:9: note: in instantiation of template class 'FarPtr<xgetvolumeinfo &>' requested here
    p = MK_FAR(*s);
        ^
../subprojects/libfdpp/farobj.hpp:178:19: note: expanded from macro 'MK_FAR'
#define MK_FAR(o) FarPtr<decltype(o)>(_MK_FAR(o))
                  ^
In file included from subprojects/libfdpp/libfdpp.so.35.10.p/network.cc:30:
In file included from ../subprojects/libfdpp/hdr/portab.h:167:
../subprojects/libfdpp/farptr.hpp:214:6: error: 'get_ptr' declared as a pointer to a reference of type 'xgetvolumeinfo &'
    T* get_ptr() const { return (T*)resolve_segoff(ptr); }
     ^
../subprojects/libfdpp/farptr.hpp:359:15: error: 'operator type-parameter-0-0 *' declared as a pointer to a reference of type 'xgetvolumeinfo &'
    operator T*() {
              ^
subprojects/libfdpp/libfdpp.so.35.10.p/network.cc:164:9: note: in instantiation of template class 'FarPtr<xgetvolumeinfo &>' requested here
    p = MK_FAR(*s);
        ^
../subprojects/libfdpp/farobj.hpp:178:19: note: expanded from macro 'MK_FAR'
#define MK_FAR(o) FarPtr<decltype(o)>(_MK_FAR(o))
                  ^
In file included from subprojects/libfdpp/libfdpp.so.35.10.p/network.cc:30:
In file included from ../subprojects/libfdpp/hdr/portab.h:167:
../subprojects/libfdpp/farptr.hpp:368:6: error: 'operator->' declared as a pointer to a reference of type 'xgetvolumeinfo &'
    T* operator ->() const {
     ^
subprojects/libfdpp/libfdpp.so.35.10.p/network.cc:164:7: error: no viable overloaded '='
    p = MK_FAR(*s);
    ~ ^ ~~~~~~~~~~
../subprojects/libfdpp/farptr.hpp:308:16: note: candidate function not viable: no known conversion from 'FarPtr<decltype(*s)>' to 'const FarPtr<xgetvolumeinfo>' for 1st argument
    FarPtr<T>& operator = (const FarPtr<T>& f) {
               ^
5 errors generated.

@andrewbird
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a draft PR, else this discussion will be spread over each commit. see dosemu2#249

@stsp
Copy link

@stsp stsp commented on 725fb3e Mar 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK in this case you can still
pass the struct as a pointer
and have a local struct too,
and at the end you can do:
*s_ptr = s;

Please sign in to comment.