Kernel: Use a FlatPtr for the "argument" to ioctl()

Since it's often used to pass pointers, it should really be a FlatPtr.
This commit is contained in:
Andreas Kling 2020-05-23 13:17:58 +02:00
parent b8af5cd8da
commit b3736c1b1e
Notes: sideshowbarker 2024-07-19 06:13:21 +09:00
14 changed files with 14 additions and 14 deletions

View file

@ -192,7 +192,7 @@ KResultOr<Region*> BXVGADevice::mmap(Process& process, FileDescription&, Virtual
return region;
}
int BXVGADevice::ioctl(FileDescription&, unsigned request, unsigned arg)
int BXVGADevice::ioctl(FileDescription&, unsigned request, FlatPtr arg)
{
REQUIRE_PROMISE(video);
switch (request) {

View file

@ -40,7 +40,7 @@ public:
BXVGADevice();
virtual int ioctl(FileDescription&, unsigned request, unsigned arg) override;
virtual int ioctl(FileDescription&, unsigned request, FlatPtr arg) override;
virtual KResultOr<Region*> mmap(Process&, FileDescription&, VirtualAddress preferred_vaddr, size_t offset, size_t, int prot, bool shared) override;
private:

View file

@ -73,7 +73,7 @@ KResultOr<Region*> MBVGADevice::mmap(Process& process, FileDescription&, Virtual
return region;
}
int MBVGADevice::ioctl(FileDescription&, unsigned request, unsigned arg)
int MBVGADevice::ioctl(FileDescription&, unsigned request, FlatPtr arg)
{
REQUIRE_PROMISE(video);
switch (request) {

View file

@ -40,7 +40,7 @@ public:
MBVGADevice(PhysicalAddress addr, size_t pitch, size_t width, size_t height);
virtual int ioctl(FileDescription&, unsigned request, unsigned arg) override;
virtual int ioctl(FileDescription&, unsigned request, FlatPtr arg) override;
virtual KResultOr<Region*> mmap(Process&, FileDescription&, VirtualAddress preferred_vaddr, size_t offset, size_t, int prot, bool shared) override;
private:

View file

@ -50,7 +50,7 @@ void File::close()
{
}
int File::ioctl(FileDescription&, unsigned, unsigned)
int File::ioctl(FileDescription&, unsigned, FlatPtr)
{
return -ENOTTY;
}

View file

@ -76,7 +76,7 @@ public:
virtual ssize_t read(FileDescription&, size_t, u8*, ssize_t) = 0;
virtual ssize_t write(FileDescription&, size_t, const u8*, ssize_t) = 0;
virtual int ioctl(FileDescription&, unsigned request, unsigned arg);
virtual int ioctl(FileDescription&, unsigned request, FlatPtr arg);
virtual KResultOr<Region*> mmap(Process&, FileDescription&, VirtualAddress preferred_vaddr, size_t offset, size_t size, int prot, bool shared);
virtual String absolute_path(const FileDescription&) const = 0;

View file

@ -462,7 +462,7 @@ KResult IPv4Socket::getsockopt(FileDescription& description, int level, int opti
}
}
int IPv4Socket::ioctl(FileDescription&, unsigned request, unsigned arg)
int IPv4Socket::ioctl(FileDescription&, unsigned request, FlatPtr arg)
{
REQUIRE_PROMISE(inet);

View file

@ -63,7 +63,7 @@ public:
virtual KResult setsockopt(int level, int option, const void*, socklen_t) override;
virtual KResult getsockopt(FileDescription&, int level, int option, void*, socklen_t*) override;
virtual int ioctl(FileDescription&, unsigned request, unsigned arg) override;
virtual int ioctl(FileDescription&, unsigned request, FlatPtr arg) override;
bool did_receive(const IPv4Address& peer_address, u16 peer_port, KBuffer&&);

View file

@ -2636,7 +2636,7 @@ int Process::sys$setpgid(pid_t specified_pid, pid_t specified_pgid)
return 0;
}
int Process::sys$ioctl(int fd, unsigned request, unsigned arg)
int Process::sys$ioctl(int fd, unsigned request, FlatPtr arg)
{
auto description = file_description(fd);
if (!description)

View file

@ -243,7 +243,7 @@ public:
unsigned sys$alarm(unsigned seconds);
int sys$access(const char* pathname, size_t path_length, int mode);
int sys$fcntl(int fd, int cmd, u32 extra_arg);
int sys$ioctl(int fd, unsigned request, unsigned arg);
int sys$ioctl(int fd, unsigned request, FlatPtr arg);
int sys$mkdir(const char* pathname, size_t path_length, mode_t mode);
clock_t sys$times(tms*);
int sys$utime(const char* pathname, size_t path_length, const struct utimbuf*);

View file

@ -124,7 +124,7 @@ void MasterPTY::close()
}
}
int MasterPTY::ioctl(FileDescription& description, unsigned request, unsigned arg)
int MasterPTY::ioctl(FileDescription& description, unsigned request, FlatPtr arg)
{
REQUIRE_PROMISE(tty);
if (!m_slave)

View file

@ -56,7 +56,7 @@ private:
virtual bool can_write(const FileDescription&, size_t) const override;
virtual void close() override;
virtual bool is_master_pty() const override { return true; }
virtual int ioctl(FileDescription&, unsigned request, unsigned arg) override;
virtual int ioctl(FileDescription&, unsigned request, FlatPtr arg) override;
virtual const char* class_name() const override { return "MasterPTY"; }
RefPtr<SlavePTY> m_slave;

View file

@ -279,7 +279,7 @@ void TTY::set_termios(const termios& t)
#endif
}
int TTY::ioctl(FileDescription&, unsigned request, unsigned arg)
int TTY::ioctl(FileDescription&, unsigned request, FlatPtr arg)
{
REQUIRE_PROMISE(tty);
auto& process = *Process::current;

View file

@ -43,7 +43,7 @@ public:
virtual ssize_t write(FileDescription&, size_t, const u8*, ssize_t) override;
virtual bool can_read(const FileDescription&, size_t) const override;
virtual bool can_write(const FileDescription&, size_t) const override;
virtual int ioctl(FileDescription&, unsigned request, unsigned arg) override final;
virtual int ioctl(FileDescription&, unsigned request, FlatPtr arg) override final;
virtual String absolute_path(const FileDescription&) const override { return tty_name(); }
virtual StringView tty_name() const = 0;