Skip to content

Commit

Permalink
[warnings] remove some extraneous __PACKED attributes
Browse files Browse the repository at this point in the history
Also remove a few extra data structures that were marked packed but not
otherwise used anywhere.
  • Loading branch information
travisg committed Apr 19, 2024
1 parent 6ed6f36 commit 9a4fae0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 25 deletions.
21 changes: 0 additions & 21 deletions dev/bus/pci/include/dev/bus/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,6 @@ typedef struct {
bool valid;
} pci_bar_t;

typedef struct {
uint8_t id;
uint8_t next;
} __PACKED pci_capability_t;

typedef struct {
uint8_t bus;
uint8_t device;
uint8_t link_int_a;
uint16_t irq_int_a;
uint8_t link_int_b;
uint16_t irq_int_b;
uint8_t link_int_c;
uint16_t irq_int_c;
uint8_t link_int_d;
uint16_t irq_int_d;
uint8_t slot;
uint8_t reserved;
} __PACKED irq_routing_entry;


// only use one of these two:
// try to detect PCI based on legacy PC PCI accessor methods
status_t pci_init_legacy(void);
Expand Down
2 changes: 1 addition & 1 deletion dev/include/hw/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ typedef struct {
uint16_t bridge_control;
} type1; // configuration for bridge devices
};
} __PACKED pci_config_t;
} pci_config_t;
static_assert(sizeof(pci_config_t) == 0x40, "");

/* Class/subclass codes (incomplete) */
Expand Down
4 changes: 4 additions & 0 deletions lib/partition/include/lib/partition.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
*/
#pragma once

#include <lk/compiler.h>
#include <sys/types.h>

__BEGIN_CDECLS

/* examine and try to publish partitions on a particular device at a particular offset */
int partition_publish(const char *device, off_t offset);

/* remove any published subdevices on this device */
int partition_unpublish(const char *device);

__END_CDECLS
9 changes: 6 additions & 3 deletions lib/partition/partition.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT
*/
#include "lib/partition.h"

#include <lk/debug.h>
#include <stdio.h>
#include <string.h>
#include <lk/compiler.h>
#include <stdlib.h>
#include <arch.h>
#include <lib/bio.h>
#include <lib/partition.h>
#include <assert.h>

struct chs {
uint8_t c;
uint8_t h;
uint8_t s;
} __PACKED;
};

struct mbr_part {
uint8_t status;
Expand All @@ -27,7 +29,8 @@ struct mbr_part {
struct chs end;
uint32_t lba_start;
uint32_t lba_length;
} __PACKED;
};
static_assert(sizeof(struct mbr_part) == 16, "");

static status_t validate_mbr_partition(bdev_t *dev, const struct mbr_part *part) {
/* check for invalid types */
Expand Down
1 change: 1 addition & 0 deletions lib/tga/tga.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ struct tga_header {
uint8_t bitsperpixel;
uint8_t imagedescriptor;
} __PACKED;
static_assert(sizeof(struct tga_header) == 18, "");

static void print_tga_info(const struct tga_header *header) {
LTRACEF("idlength %hhd\n", header->idlength);
Expand Down

0 comments on commit 9a4fae0

Please sign in to comment.